<template>
  <cml-module-item :title="titleText">
    <a-switch
      size="small"
      :checked="isSystemCheckOpen"
      @change="change"
    />
  </cml-module-item>
</template>
<script>
import { Switch, Select } from 'ant-design-vue'
import CmlModuleItem from '../cml-module-item'
import { mapState, mapMutations } from 'vuex'
import * as anov from 'anov-core'
// https://cn.vuejs.org/v2/style-guide/#组件-实例的选项的顺序-推荐
export default {
  name: 'Check',
  components: {
    ASwitch: Switch,
    CmlModuleItem
  },
  model: {},
  props: {},
  data() {
    return {
    }
  },
  watch: {
    isSystemCheckOpen(v) {
      if (v) {
        anov.systemCheckServer.open()
        anov.voiceFeedbackServer.speak(`系统自检已开启`)
        app.modal.open({componentsName: 'systemCheck'})
      } else {
        anov.systemCheckServer.close()
        anov.voiceFeedbackServer.speak(`系统自检已关闭`)
        app.modal.destroy({componentsName: 'systemCheck'})
      }
    }
  },
  computed: {
    ...anov.systemCheckServer.mapState(['isSystemCheckOpen']),
    titleText() {
      return this.$t('cmlpanel.systemCheck')
    }
  },
  created() {},
  mounted() {},
  beforeDestroy() {},
  methods: {
    change(v){
        anov.systemCheckServer.isSystemCheckOpen = v
    }
  }
}
</script>
<style lang="scss" scoped></style>
